const mongoose = require('mongoose');

const PatternSchema = new mongoose.Schema({
  name: {
    type: String,
    required: true,
    unique: true
  },
  category: {
    type: String,
    required: true,
    enum: ['Creational', 'Structural', 'Behavioral']
  },
  description: {
    type: String,
    required: true
  },
  intent: {
    type: String,
    required: true
  },
  applicability: {
    type: String,
    required: true
  },
  structure: {
    type: String,
    required: true
  },
  participants: {
    type: String,
    required: true
  },
  collaborations: {
    type: String,
    required: true
  },
  consequences: {
    type: String,
    required: true
  },
  implementation: {
    type: String,
    required: true
  },
  sampleCode: {
    type: String,
    required: true
  },
  knownUses: {
    type: String,
    required: true
  },
  relatedPatterns: {
    type: [String],
    default: []
  },
  order: {
    type: Number,
    required: true
  }
}, {
  timestamps: true
});

module.exports = mongoose.model('Pattern', PatternSchema); 